package com.elitedatai.mchtest.wayline.service;

import com.dji.sdk.cloudapi.wayline.GetWaylineListRequest;
import com.dji.sdk.cloudapi.wayline.GetWaylineListResponse;
import com.dji.sdk.common.PaginationData;
import com.elitedatai.mchtest.wayline.model.dto.WaylineFileDTO;
import org.springframework.web.multipart.MultipartFile;
import java.net.URL;
import java.sql.SQLException;
import java.util.List;
import java.util.Optional;


public interface IWaylineFileService {

    /**
     * 根据查询参数进行分页查询
     * @param workspaceId
     * @param param
     * @return
     */
    PaginationData<GetWaylineListResponse> getWaylinesByParam(String workspaceId, GetWaylineListRequest param);

    /**
     * 根据航线id查询航线文件信息
     * @param workspaceId
     * @param waylineId
     * @return
     */
    Optional<GetWaylineListResponse> getWaylineByWaylineId(String workspaceId, String waylineId);

    /**
     * 获取航线文件的下载地址
     * @param workspaceId
     * @param waylineId
     * @return
     */
    URL getObjectUrl(String workspaceId, String waylineId) throws SQLException;

    /**
     * 保存航线文件的基本信息
     * @param workspaceId
     * @param metadata
     * @return
     */
    Long saveWaylineFile(String workspaceId, WaylineFileDTO metadata);

    /**
     * 根据航线id收藏或取消收藏航线文件
     * @param workspaceId
     * @param ids          wayline id
     * @param isFavorite   Whether the wayline file is favorited or not.
     * @return
     */
    Boolean markFavorite(String workspaceId, List<String> ids, Boolean isFavorite);

    /**
     * 批量查询工作空间内的重复文件名
     * @param workspaceId
     * @param names
     * @return
     */
    List<String> getDuplicateNames(String workspaceId, List<String> names);

    /**
     * 根据航线id删除这个工作空间内的航线文件
     * @param workspaceId
     * @param waylineId
     */
    Boolean deleteByWaylineId(String workspaceId, String waylineId);

    /**
     * 导入kmz航线文件
     * @param file
     * @param workspaceId
     * @param creator
     * @return
     */
    void importKmzFile(MultipartFile file, String workspaceId, String creator);
}
